<h2 class="alternate">Eligibility Screening</h2>

<form action="%%[base_url]%%/ops/update_case.php" method="post" name="ws"onsubmit="return testcitempty()">

    <div id="household">

            <ul>
            <li><label>Adults</label>* <input type="text" name="adults" value="%%[adults]%%" onchange="ph_change();" tabindex="1" /></li>
            <li><label>Children</label>* <input type="text" name="children" value="%%[children]%%" onchange="ph_change();" tabindex="1" /></li>
            <li><label>HH size</label>* <input type="text" name="persons_helped" value="%%[persons_helped]%%" tabindex="1" /></li>
            </ul>

        </div> <!-- /#household -->

        <div id="wage">

            <ul>
            <li><label>Hourly wage</label> $ <input type="text" name="dontuse1" onchange="calcWage();" tabindex="1" /></li>
            <li><label>x Hours/week</label>&nbsp;&nbsp;<input type="text" name="dontuse2" onchange="calcWage();" tabindex="1" /></li>
            <li><label>= </label> $ <input type="text" name="dontuse3" tabindex="1" /></li>
            </ul>

        </div> <!-- /#wage -->

        <div id="send-decline">

            %%[eligd,yes_no,checkbox]%%<label>Income/Assets Not Required</label>

            <ul>
            <li>
            <input type="button" value="Send to Grid" onclick="sendToGrid();" title="Send wage calculation to the income grid." tabindex="1" /></li>
            </ul>

        </div> <!-- /#send-decline -->

        <div id="grid-wrapper"> <!-- begin #grid-wrapper -->

        <!-- income grid -->

        <table class="eligibility-grid" id="income-grid">

            <colgroup id="income-type">
            <col span="3" />
            </colgroup>

            <thead>
            <tr>

                <th class="first" scope="col">Income Type</th>
                <th scope="col">Frequency</th>
                <th class="last" scope="col">Amount</th>

            </tr>
            </thead>

            <tbody>

            <tr> <!-- row 1  -->

                <td>%%[income_type0,income_type]%%</td>
                <td>%%[income_freq0,income_freq]%%</td>
                <td class="amount">$ <input type="text" name="annual0" value="%%[annual0]%%" tabindex="1" /></td>

            </tr>

            <tr> <!-- row 2 -->

                <td>%%[income_type1,income_type]%%</td>
                <td>%%[income_freq1,income_freq]%%</td>
                <td class="amount">$ <input type="text" name="annual1" value="%%[annual1]%%" tabindex="1" /></td>

            </tr>

            <tr> <!-- row 3 -->

                <td>%%[income_type2,income_type]%%</td>
                <td>%%[income_freq2,income_freq]%%</td>
                <td class="amount">$ <input type="text" name="annual2" value="%%[annual2]%%" tabindex="1" /></td>

            </tr>

            <tr> <!-- row 4 -->

                <td>%%[income_type3,income_type]%%</td>
                <td>%%[income_freq3,income_freq]%%</td>
                <td class="amount">$ <input type="text" name="annual3" value="%%[annual3]%%" tabindex="1" /></td>

            </tr>

            <tr> <!-- row 5 -->

                <td>%%[income_type4,income_type]%%</td>
                <td>%%[income_freq4,income_freq]%%</td>
                <td class="amount">$ <input type="text" name="annual4" value="%%[annual4]%%" tabindex="1" /></td>

             </tr>

             <tr class="total-row"> <!-- row 6 = totals -->

                <td>&nbsp;</td>
                <td class="amount" colspan="2"><b>Total = $ <input type="text" name="income" tabindex="1" value="%%[income]%%" readonly="readonly" /><input type="hidden" name="income_only" /></td>

            </tr>

            </tbody>

        </table> <!-- /#income grid -->

        <!-- asset grid -->

        <table class="eligibility-grid" id="asset-grid">

            <colgroup span="2">
            <col id="asset-type" span="1" />
            <col span="1" />
            </colgroup>

            <thead>
            <tr>

                <th class="first" scope="col">Asset Type</th>
                <th class="last" scope="col">Value</th>

            </tr>
            </thead>

            <tbody>

            <tr> <!-- row 1  -->

                <td>%%[asset_type0,asset_type]%%</td>
                <td class="amount">$ <input type="text" name="asset0" onchange="asset_change();" value="%%[asset0]%%" tabindex="1" /></td>

            </tr>

            <tr> <!-- row 2 -->

                <td>%%[asset_type1,asset_type]%%</td>
                <td class="amount">$ <input type="text" name="asset1" tabindex="1" onchange="asset_change();" value="%%[asset1]%%" /></td>

            </tr>

            <tr> <!-- row 3 -->

                <td>%%[asset_type2,asset_type]%%</td>
                <td class="amount">$ <input type="text" name="asset2" tabindex="1" onchange="asset_change();" value="%%[asset2]%%" /></td>

            </tr>

            <tr> <!-- row 4 -->

                <td>%%[asset_type3,asset_type]%%</td>
                <td class="amount">$ <input type="text" name="asset3" tabindex="1" onchange="asset_change();" value="%%[asset3]%%" /></td>

            </tr>

            <tr> <!-- row 5 -->

                <td>%%[asset_type4,asset_type]%%</td>
                <td class="amount">$ <input type="text" name="asset4" tabindex="1" onchange="asset_change();" value="%%[asset4]%%" /></td>

            </tr>

            <tr class="total-row"> <!-- row 6 = totals -->

                <td class="amount" colspan="2">Total = $ <input type="text" name="assets" tabindex="1" value="%%[assets]%%" readonly="readonly" /></td>

            </tr>

            </tbody>

        </table> <!-- /#asset-grid -->

        </div> <!-- /#end grid-wrapper -->

        <!-- calculate poverty ... income justification -->

        <div id="poverty">

            <dl>

        	    <dt><h4>% of Poverty</h4></dt>
            	<dd><input id="calculate" type="button" value="Calculate" tabindex="1" onclick="calc_poverty();" title="Calculate percentage of poverty." />
                <input id="percentage" class="input60" type="text" name="poverty" value="%%[poverty]%%" readonly="readonly" />

            </dl>

            <input type="hidden" name="poverty_income_only" /></dd>

            <dl>

            	<dt><h4>Income Justification</h4></dt>
                <dd>%%[just_income,just_income]%%</dd>

            </dl>

        </div> <!-- /#poverty -->

        <dl id="prospects">

            <dt><label>Inquired about<br />
            Income Prospects</label>*</dt>
            <dd>%%[income_prospects,yes_no,checkbox]%%</dd>

        </dl>

        <dl>

            <dt><label>Citizenship Status</label>*</dt>
            <dd>%%[citizen,citizen]%%</dd>

            <dt><label>Immigrant Status</label>*</dt>
            <dd>%%[noncitizentype,noncitizentype]%%</dd>

            <dt><label>Immigration Document Type</label>*</dt>
            <dd>%%[noncitizendoc,noncitizendoc]%%</dd>

            <dt><label>Document No.</label>*</dt>
            <dd><input type="text" name="noncitizendocnum" value="%%[noncitizendocnum]%%" title="Enter the applicant's specific immigrant-status document number, if any." /></dd>

            <dt><label>Eligibility Notes</label></dt>
            <dd id="intake-notes"><textarea name="elig_notes" cols="" rows="6" tabindex="1">%%[elig_notes]%%</textarea></dd>

        </dl>

<input type="hidden" name="screen" value="elig"/>
<input type="hidden" name="case_id" value="%%[case_id]%%"/>
<input type="hidden" name="client_age" value="%%[client_age]%%"/>

        <ul id="submit-info">
        <li><input type=submit name="update_case" value="Save" tabindex="2" class="save" accesskey="s" /></li>
        </ul>

</form>

<script type="text/javascript" language="JavaScript">
<!--
document.ws.children.focus();
//-->
</script>


<script type="text/javascript" language="JavaScript" src="%%[base_url]%%/js/case_elig.js.php"></script>

<script type="text/javascript" language="JavaScript">

function testfields(what) {
  if((document.ws.adults.value=="") || (document.ws.children.value=="") || (document.ws.persons_helped.value=="")){

alert("The number of adults,children and persons helped must be entered.");
return false;
  }
  return testassets(this);
 }

function testfields1(what) {
  if((document.ws.income_type0.value=="") || (document.ws.income_freq0.value=="") || (document.ws.annual0.value=="")){

alert("The first row of Income Type,Frequency and Amount must be completed.");
return false;
  }
  return prospects();
 }

function testassets(what) {
  if((document.ws.asset_type0.value=="") ||
(document.ws.asset_type0.value!="")&&(document.ws.asset0.value=="") ||
(document.ws.asset_type1.value!="")&&(document.ws.asset1.value=="") || (document.ws.asset_type2.value!="")&&(document.ws.asset2.value=="") || (document.ws.asset_type3.value!="")&&(document.ws.asset3.value=="") || (document.ws.asset_type4.value!="")&&(document.ws.asset4.value=="")) {

alert("You have an entered an asset type with no value or no assets at all.");
return false;
  }
  return testexempt();
 }
function testexempt(what) {
  if((document.ws.asset_type0.value >9)&&(document.ws.asset0.value >0) ||
(document.ws.asset_type1.value >9)&&(document.ws.asset1.value >0) || (document.ws.asset_type2.value >9)&&(document.ws.asset2.value >0) || (document.ws.asset_type3.value >9)&&(document.ws.asset3.value >0) || (document.ws.asset_type4.value >9)&&(document.ws.asset4.value >0))


{

alert("Exempt assets must have a value of zero $0.00");


return false;
  }

  return testfields1();
 }

function isChecked(fieldname) {
	var myform = document.ws;
	if (myform) {
		loop = 0;
		while (loop < myform.elements.length) {
			if (myform.elements[loop].name == fieldname && myform.elements[loop].type == 'checkbox') {
				return(myform.elements[loop].checked);
			}
		loop++;
		}
	}
if (isChecked('eligd')) {
	window.alert('Client has declined to provide financial data. Income and asset validation is now turned off')
return (true);
}
return testfields();

}

function testcitempty(what) {
  if(document.ws.citizen.value=="") {

alert("You must select a Citizenship Status!");
return false;
  }
  return testcitizen(this);
 }

function testcitizen(what) {
  if((document.ws.citizen.value=="A")&&(document.ws.noncitizentype.value!="") ||
     (document.ws.citizen.value=="A")&&(document.ws.noncitizendoc.value!="")) {

alert("You have selected Citizen! Alien Status and Document Type should be blank!");
return false;
  }
  return testalien(this);
 }

function testalien(what) {
  if((document.ws.citizen.value=="B")&&(document.ws.noncitizentype.value=="") ||
     (document.ws.citizen.value=="B")&&(document.ws.noncitizendoc.value=="") ||
     (document.ws.citizen.value=="C")&&(document.ws.noncitizentype.value=="") ||
     (document.ws.citizen.value=="C")&&(document.ws.noncitizendoc.value=="")) {

alert("You have made a selection other than Citizen! Alien Status and Document Type should not be blank!");
return false;
  }
  return isChecked();
 }

function testpoverty(what) {
  if((document.ws.poverty.value >125)&&(document.ws.just_income.value ==""))
{
 
alert("Client is over 125% of poverty. Please select an Income Justification.");
 
 
return false;
  }
 
  return testhouseholdzero();
 }
function testhouseholdzero(what) {
  if(document.ws.persons_helped.value==0)
{
 
alert("Household size cannot be zero");
 
 
return false;
  }
 
  return testpovertynull();
 }




function testpovertynull(what) {
  if(document.ws.poverty.value =="")
{
 
alert("Please calculate % of Poverty and save");
 
 
return false;
  }
 
  return true;
 }



function prospects(fieldname) {
	var myform = document.ws;
	if (myform) {
		loop = 0;
		while (loop < myform.elements.length) {
			if (myform.elements[loop].name == fieldname && myform.elements[loop].type == 'checkbox') {
				return(myform.elements[loop].checked);
			}
		loop++;
		}
	}
if (!isChecked('income_prospects')) {
	window.alert('Please inquire about Income Prospects and check the box.')
return (false);
}
return testpoverty();

}



<!--
// The second (non-adjusted) Income field needs to be calculated on each page view (it's not in the DB.)
income_change();
//-->
</script>
